home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 2510.ZIP / TRSOURCE.EXE / TR_EOW.PRG < prev    next >
Text File  |  1990-10-22  |  747b  |  27 lines

  1. *********
  2. *  EOW
  3. *  by Tom Rettig
  4. *  modified by Leonard Zerman
  5. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  6. *
  7. *  Syntax: EOW( <expD> )
  8. *  Return: Date of the first Sunday same as or following <expD>
  9. *  Note  : To make this function return Friday instead of Sunday,
  10. *          replace the conditions specified below.
  11. *********
  12.  
  13. FUNCTION EOW
  14. *
  15. PARAMETERS tr_date
  16.  
  17. DO CASE
  18.    CASE DOW(tr_date) = 1         && replace 1 with 5 to return Friday
  19.       RETURN tr_date
  20.    CASE DOW(tr_date) = 2         && replace 2 with 7 to return Friday
  21.       RETURN tr_date + 6
  22.    OTHERWISE
  23.       RETURN tr_date + ( 8 - DOW(tr_date) )
  24. ENDCASE                          && replace 8 with 2 to return Friday
  25. * eofunc EOW
  26.  
  27.